package com.blx.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.blx.model.request.DealDemandRequest;
import com.blx.model.request.DemandRequest;
import com.blx.model.response.DemandResponse;
import com.blx.service.DemandService;
import com.blx.utils.annotation.NeedLogin;

/**
 * ClassName:  DemandController. <br/>
 * Description:  DemandController 页面处理类 <br/>
 * @author wangwl
 * 2013-3-4 下午10:04:16 <br/>
 * @version 1.0
 */
@Controller
@RequestMapping("/demand")
public class DemandController {

	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private DemandService demandService;
	
	/**
	 *  
	* @Description: 用户发布需求
	 */
	@NeedLogin
	@RequestMapping("addDemand")
	@ResponseBody
	public DemandResponse addDemand(@RequestBody DemandRequest domandRequest){
		try {
			demandService.saveDemand(domandRequest);
			return DemandResponse.getSuccessResponse();
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("",e);
			return DemandResponse.getErrorResponse();
		}
	}
	@NeedLogin
	@RequestMapping("dealDemand")
	@ResponseBody
	public DemandResponse dealDemand(@RequestBody DealDemandRequest request){
		return null;
	}
}

